package com.qyhl.module_activities.act;


import com.qyhl.webtv.commonlib.entity.act.ActivityListTempBean;

import java.util.List;

/**
 * Created by qyhl2 on 2017/12/6.
 */

public class ActivityTempPresenter implements ActivityTempContract.ActivityTempPresenter {

    private final ActivityTempContract.ActivityTempView mView;
    private final ActivityTempModel mModel;

    public static final int DATA_TYPE_NORMAL = 1;
    public static final int DATA_TYPE_JOINED = 2;
    public static final int DATA_TYPE_COLLECTION = 3;

    public ActivityTempPresenter(ActivityTempContract.ActivityTempView mView) {
        this.mView = mView;
        this.mModel = new ActivityTempModel(this);
    }

    @Override
    public void onError(int code, String message) {
        mView.onError(message);
    }

    @Override
    public void onSuccess(List<ActivityListTempBean> data) {
        mView.onSuccess(data);
    }

    @Override
    public void getData(int actId, int type) {
        switch (type) {
            case DATA_TYPE_NORMAL:
                mModel.getData(actId);
                break;
            case DATA_TYPE_JOINED:
                mModel.getApplyData(actId);
                break;
            case DATA_TYPE_COLLECTION:
                mModel.getCollectionData(actId);
                break;
            default:
        }
    }
}
